package com.ithiema.write;

import com.alibaba.excel.EasyExcel;
import com.ithiema.pojo.Employee;
import com.ithiema.utils.TestFileUtil;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

/*
    练习easyexcel的简单写数据
 */
public class SimpleWrite {

    @Test
    public void testWrite(){
        String name = TestFileUtil.getPath() + "简单写数据" + System.currentTimeMillis() + ".xlsx";
        EasyExcel.write(name, Employee.class).sheet("我的快速入门").doWrite(data(100000));
    }


    // 准备测试数据的方法
    private List<Employee> data(int i) {
        List<Employee> list = new ArrayList<>();
        for (int j = 1; j <= i; j++) {
            list.add(new Employee(j,"测试数据"+j,6.6*j,new Date()));
        }
        return list;
    }
}
